<template>
	<view class="boxStap">
		<view class="navItem">
			<view class="name">{{name}}</view>
			<view class="boxMo"> <image src="/static/promotion.png" mode=""></image> ￥{{total}}</view>
			<!-- <view>
				
			</view> -->
			<!-- <view>
				<image class="img" src="../../../static/imgs/yj.png"></image>
			</view> -->
		</view>
		<view class="itemMOney">
			<view class="itemMOneyTitle">
				<text>佣金记录</text>
			</view>
			<view class="itemMOneyItem" v-for="item in array">
				<view>
					<view class="boxtitle">{{item.title}}</view>
					<view class="dateBox">{{item.time | formatTime}}</view>
				</view>
				<view class="boxCla">+{{item.value}}</view>
			</view>
		</view>
		
	</view>
</template>
<script>
	import {
		getYjdetalFn
	} from "@/request/api.js";
	export default {
		data() {
			return {
				total:0,
				name:'',
				array:[
					// {
					// 	title:'推广用户奖励',
					// 	time:'2023-10-21 10:20:00',
					// 	value:1000
					// }
				]

			}
		},
		onLoad(option) {
			let that = this
			that.name = option.name;
			that.setOption()
		},
		methods: {
			//获取佣金明细
			async setOption() {
				let that = this
				let res = await getYjdetalFn({
					method: "GET",
					data: {
						pageNo: 1,
						pageSize: 30
					},
				})
				if (res.code == 200) {
					if(res.result.transactions.length<=0){
						return
					}else {
						let num = 0 
						res.result.transactions.forEach(item=>{
							num = Number(num) + Number(Number(item.value)/100)
						})
						res.result.transactions.forEach(item=>{
							item.value = (Number(item.value)/100).toFixed(2)
						})
						that.array = res.result.transactions
						that.total = num.toFixed(2)
					}
				}else {
					uni.showToast({
						title: res.message,
						icon: "none",
					});
				}
				console.log(res, 'resresres');
			}
		}
	}
</script>
<style lang="scss" scoped>
	.boxStap{
		background: linear-gradient(to bottom, #ec5d21, #fff 50%);
		min-height: 100vh;
		padding-top:30rpx;
	}
	
	.navItem {
		@include flexs(space-around, center);
		flex-direction: column;
		height:176rpx;
		margin:0 30rpx 30rpx;
		background-color: #EB5B1E;
		color: #fff;
		border-radius: 30rpx;
		padding:30rpx;
		font-weight: 600;
		.img {
			width: 140rpx;
			height: 140rpx;
		}
		.name{
			font-size:40rpx;
		}
		.boxMo {
			@include flexs(space-between, center);
			font-size: 48rpx;
			image{
				width:56rpx;
				height:56rpx;
				display: inline-block;
				margin-right:10rpx;
			}
		}
	}
	.itemMOney {
		margin-top: 25rpx;
		
		
		background:#fff;
		border-radius:20rpx;
		margin:40rpx 30rpx; 
		.boxtitle {
			font-size: 28rpx;
			font-weight: 600;
		}
		.dateBox {
			font-size:22rpx;
			margin-top: 16rpx;
		}
		.boxCla {
			color: #EB5B1E;
			font-size: 32rpx;
			font-weight: 600;
		}
		&Title{
			height:104rpx;
			line-height: 104rpx;
			font-size:40rpx;
			font-weight: 600;
			text-align: center;
			text{
				display: inline-block;
				position: relative;
				&::after,&::before{
					position: absolute;
					top:50%;
					transform: translateY(-50%);
					content: '';
					width:100rpx;
					height:2rpx;
					background:#000;
				}
				&::before{
					left:-110rpx;
				}
				&::after{
					right:-110rpx;
				}
			}
		}
		&Item{
			@include flexs(space-between, center);
			border-top: 1rpx solid #EEEEEE;
			padding:20rpx 0;
			margin:0 30rpx;
		}
	}
</style>